package com.lanou3g.code0522.listener;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;

/**
 * If there are no bugs, it was created by Chen FengYao on 2018/5/22;
 * Otherwise, I don't know who created it either
 */

/*
如果在同一个项目中 注册了相同类型的Listener
那么方法回调的顺序 :
1. 如果在web.xml中注册,那么按照注册顺序回调
2. 如果使用注解注册,那么按照类名(包名.类名)
    字母排序的顺序回调
3. 如果一个在web.xml中,一个用注解
    web.xml永远会优先于注解
 */
@WebListener
public class AThirdListener implements HttpSessionAttributeListener {
    @Override
    public void attributeAdded(HttpSessionBindingEvent se) {
        System.out.println("ThirdListener");
    }

    @Override
    public void attributeRemoved(HttpSessionBindingEvent se) {

    }

    @Override
    public void attributeReplaced(HttpSessionBindingEvent se) {

    }
}
